<?php

/**
 * This controller do the functions like: show list, deleted, redirect paypal
 */
class CartController extends Controller {

    public function actionIndex() {

	if (isset(Yii::app()->session['order'])) {
	    
	}
	$aCat = Category::getListCat();
	$this->render('index', array('aCat' => $aCat));
    }

    /**
     * Delete order in cart
     */
    public function actionDelete() {
	if (isset($_POST['idOrder'])) {
	    if (isset(Yii::app()->session['order'])) {
		$aOrder = Yii::app()->session['order'];

		if (array_key_exists($_POST['idOrder'], $aOrder)) {
		    unset($aOrder[$_POST['idOrder']]);
		    Yii::app()->session['order'] = $aOrder;
		}
	    }
	}
    }

}

